﻿using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;

namespace Vestras.StarCraft2.Luna.Parser {
    public sealed class FileNetwork {
        List<string> includedFiles = new List<string>();

        public ReadOnlyCollection<string> IncludedFiles {
            get {
                return new ReadOnlyCollection<string>(includedFiles);
            }
        }

        public void FilterIncludedFiles(System.Func<string, bool> selector) {
            List<string> itemsToRemove = new List<string>();
            foreach (string item in includedFiles) {
                if (selector(item)) {
                    itemsToRemove.Add(item);
                }
            }

            itemsToRemove.ForEach(item => includedFiles.Remove(item));   
        }

        public FileNetwork(IEnumerable<string> includedFiles) {
            this.includedFiles = new List<string>(includedFiles);
        }
    }
}
